<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        function fibonacci(n) {
            // 定义第一个值为0 第二个值为1
            let fibo = [0, 1];
            // 如果想要获取的序列号小于2
            if(n < 2) {
                return n;
            }
            // 获取的序列号大于等于 2
            for (let i = 2; i <= n; i++) {
                // i = 2  1
                // i = 3  3
                // i = 4  5
                // i = 5  7
                //   ...
                // i = n  2n-3
                fibo.push(fibo[i - 1] + fibo[i - 2]);
            }
            return fibo[n]
        }
    </script>
</body>
</html>